home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / src / context.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-13  |  4.3 KB  |  160 lines

  1. /* $Id: context.h,v 1.5 1997/02/27 19:57:38 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  2.2
  6.  * Copyright (C) 1995-1997  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * $Log: context.h,v $
  26.  * Revision 1.5  1997/02/27 19:57:38  brianp
  27.  * added gl_problem() function
  28.  *
  29.  * Revision 1.4  1997/02/10 19:49:50  brianp
  30.  * added gl_ResizeBuffersMESA()
  31.  *
  32.  * Revision 1.3  1996/09/19 03:14:49  brianp
  33.  * now just one parameter for gl_create_framebuffer()
  34.  *
  35.  * Revision 1.2  1996/09/15 14:20:22  brianp
  36.  * added new functions for GLframebuffer and GLvisual support
  37.  *
  38.  * Revision 1.1  1996/09/13 01:38:16  brianp
  39.  * Initial revision
  40.  *
  41.  */
  42.  
  43.  
  44. #ifndef CONTEXT_H
  45. #define CONTEXT_H
  46.  
  47.  
  48. #include "types.h"
  49.  
  50.  
  51.  
  52. #ifdef THREADS
  53.    /*
  54.     * A seperate GLcontext for each thread
  55.     */
  56.    extern GLcontext *gl_get_thread_context( void );
  57. #else
  58.    /*
  59.     * All threads use same pointer to current context.
  60.     */
  61.    extern GLcontext *CC;
  62. #endif
  63.  
  64.  
  65.  
  66. /*
  67.  * There are three Mesa datatypes which are meant to be used by device
  68.  * drivers:
  69.  *   GLcontext:  this contains the Mesa rendering state
  70.  *   GLvisual:  this describes the color buffer (rgb vs. ci), whether
  71.  *              or not there's a depth buffer, stencil buffer, etc.
  72.  *   GLframebuffer:  contains pointers to the depth buffer, stencil
  73.  *                   buffer, accum buffer and alpha buffers.
  74.  *
  75.  * These types should be encapsulated by corresponding device driver
  76.  * datatypes.  See xmesa.h and xmesaP.h for an example.
  77.  *
  78.  * The following functions create and destroy these datatypes.
  79.  */
  80.  
  81.  
  82. /*
  83.  * Create/destroy a GLvisual.  A GLvisual is like a GLX visual.  It describes
  84.  * the colorbuffer, depth buffer, stencil buffer and accum buffer which will
  85.  * be used by the GL context and framebuffer.
  86.  */
  87. extern GLvisual *gl_create_visual( GLboolean rgb_flag,
  88.                                    GLboolean alpha_flag,
  89.                                    GLboolean db_flag,
  90.                                    GLint depth_bits,
  91.                                    GLint stencil_bits,
  92.                                    GLint accum_bits,
  93.                                    GLint index_bits,
  94.                                    GLfloat red_scale,
  95.                                    GLfloat green_scale,
  96.                                    GLfloat blue_scale,
  97.                                    GLfloat alpha_scale );
  98.  
  99. extern void gl_destroy_visual( GLvisual *vis );
  100.  
  101.  
  102. /*
  103.  * Create/destroy a GLcontext.  A GLcontext is like a GLX context.  It
  104.  * contains the rendering state.
  105.  */
  106. extern GLcontext *gl_create_context( GLvisual *visual,
  107.                                      GLcontext *share_list,
  108.                                      void *driver_ctx );
  109.  
  110. extern void gl_destroy_context( GLcontext *ctx );
  111.  
  112.  
  113. /*
  114.  * Create/destroy a GLframebuffer.  A GLframebuffer is like a GLX drawable.
  115.  * It bundles up the depth buffer, stencil buffer and accum buffers into a
  116.  * single entity.
  117.  */
  118. extern GLframebuffer *gl_create_framebuffer( GLvisual *visual );
  119.  
  120. extern void gl_destroy_framebuffer( GLframebuffer *buffer );
  121.  
  122.  
  123.  
  124. extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer );
  125.  
  126. extern void gl_copy_context( GLcontext *src, GLcontext *dst, GLuint mask );
  127.  
  128.  
  129.  
  130. /*
  131.  * GL_MESA_resize_buffers extension
  132.  */
  133. extern void gl_ResizeBuffersMESA( GLcontext *ctx );
  134.  
  135.  
  136.  
  137. /*
  138.  * Miscellaneous
  139.  */
  140.  
  141. extern void gl_problem( GLcontext *ctx, const char *s );
  142.  
  143. extern void gl_warning( GLcontext *ctx, const char *s );
  144.  
  145. extern void gl_error( GLcontext *ctx, GLenum error, const char *s );
  146.  
  147. extern GLenum gl_GetError( GLcontext *ctx );
  148.  
  149.  
  150. extern void gl_update_state( GLcontext *ctx );
  151.  
  152.  
  153.  
  154. #ifdef PROFILE
  155. extern GLdouble gl_time( void );
  156. #endif
  157.  
  158.  
  159. #endif
  160.